<template>
    <div v-if="!useSearch.showSearch" class="defaultSearch">
        <!-- 历史记录 -->
        <div class="claerList">
            <div>历史记录</div>
            <div class="claerListBtn" @click="useSearch.historyList = []">
                清空历史记录<van-icon name="close" />
            </div>
        </div>
        <div class="history">
            <span v-for="(item, index) in useSearch.historyList" :key="index">{{
                item
            }}</span>
        </div>
    
        <!-- 大家都在搜索 -->
        <p>大家都在搜</p>
        <div class="allSearch">
            <span>西瓜</span>
            <span>包菜</span>
        </div>
    </div>
</template>

<script setup lang="ts">
import { useSearchStore } from '@/stores/search'
const useSearch = useSearchStore()

</script>

<style lang="scss" scoped>
p {
    font-weight: bold;
    font-size: 16px;
    padding-left: 20px;
}
span {
    display: block;
    min-width: 25%;
    font-size: 14px;
    text-align: center;
    height: 24px;
    line-height: 24px;
    background-color: #dedede;
    border-radius: 12px;
    margin-right: 20px;
    margin-bottom: 10px;
}
.allSearch,
.history {
    padding: 0 20px 0 20px;
    display: flex;
    flex-wrap: wrap;
}
.claerList {
    margin-bottom: 10px;
    font-weight: bold;
    font-size: 16px;
    padding-left: 20px;
    display: flex;
    justify-content: space-between;
    .claerListBtn {
        position: relative;
        right: 40px;
    }
}
</style>